package org.desktop.web.shared.domain.entities;

import java.io.Serializable;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Date;


/**
 * The persistent class for the TIMESHEET database table.
 * 
 */
@Entity
@Table(name="TIMESHEET")
@NamedQuery(name="Timesheet.findAll", query="SELECT t FROM Timesheet t")
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
@JsonInclude(Include.NON_NULL)
public class Timesheet implements Serializable, com.google.gwt.user.client.rpc.IsSerializable {
	private static final long serialVersionUID = 1L;
	private String id;
	private Date data;
	private int endHour;
	private int endMin;
	private int startHour;
	private int startMin;
	
	@JsonProperty("idProject")
	private Project project;
	@JsonProperty("idSubproject")
	private SubProject subProject;
	@JsonProperty("idUser")
	private User user;

	public Timesheet() {
	}


	@Id
	@Column(unique=true, nullable=false, length=100)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}


	@Temporal(TemporalType.TIMESTAMP)
	public Date getData() {
		return this.data;
	}

	public void setData(Date data) {
		this.data = data;
	}


	@Column(name="END_HOUR")
	public int getEndHour() {
		return this.endHour;
	}

	public void setEndHour(int endHour) {
		this.endHour = endHour;
	}


	@Column(name="END_MIN")
	public int getEndMin() {
		return this.endMin;
	}

	public void setEndMin(int endMin) {
		this.endMin = endMin;
	}


	@Column(name="START_HOUR")
	public int getStartHour() {
		return this.startHour;
	}

	public void setStartHour(int startHour) {
		this.startHour = startHour;
	}


	@Column(name="START_MIN")
	public int getStartMin() {
		return this.startMin;
	}

	public void setStartMin(int startMin) {
		this.startMin = startMin;
	}


	//bi-directional many-to-one association to Project
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ID_PROJECT", nullable=false)
	public Project getProject() {
		return this.project;
	}

	public void setProject(Project project) {
		this.project = project;
	}


	//bi-directional many-to-one association to SubProject
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ID_SUB_PROJECT", nullable=false)
	public SubProject getSubProject() {
		return this.subProject;
	}

	public void setSubProject(SubProject subProject) {
		this.subProject = subProject;
	}


	//bi-directional many-to-one association to User
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ID_USER", nullable=false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}